package com.example.news.controller;

import com.example.news.pojo.vo.UploadVo;
import com.example.news.service.UploadService;
import com.example.news.utils.result.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/upload")
@Tag(name = "8.上传模块")
public class UploadController {
    @Autowired
    private UploadService uploadService;

    @PostMapping("/image")
    @Operation(summary = "上传图片")
    public Result<UploadVo> uploadImage(MultipartFile file) {
        return uploadService.uploadImage(file);
    }
}
